var path = require("path");
const htmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  mode: "development",
  // entry: "./src/index.js",
  // output: {
  //     path: path.resolve(__dirname, "dist"), //设置产品的输出目录
  //     filename: "bundle.js"
  // }
  plugins: [
    new htmlWebpackPlugin({
      template: path.join(__dirname, "src/index.html"), //需要打样的文件
      filename: "index.html" //需要生成的文件
    })
  ],
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"]
      },
      {
        test: /\.scss$/,
        use: ["style-loader", "css-loader", "sass-loader?moudels"]
      },
      {
        test: /\.(jpg|png|gif|bmp|jpeg)$/,
        use: "url-loader?limit=10000&name=[hash:4]-[name].[ext]"
      },
      {
        test: /\.(ttf|eot|svg|woff|woff2)$/,
        use: "url-loader"
      },
      {
        test: /\.js|jsx$/,
        use: "babel-loader",
        exclude: /node_modules/
      }
    ]
  }
};
